
#include"getGps.h"

void serial_init(int fd) //一个初始化串口的函数
{
    struct termios options;
    tcgetattr(fd, &options);
    options.c_cflag |= (CLOCAL | CREAD);
    options.c_cflag &= ~CSIZE;
    options.c_cflag &= ~CRTSCTS;
    options.c_cflag |= CS8;
    options.c_cflag &= ~CSTOPB;
    options.c_iflag |= IGNPAR;
    options.c_oflag  = 0;
    options.c_lflag  = 0;

    cfsetispeed(&options, B115200); //注意这里是4800
    cfsetospeed(&options, B115200);
    tcsetattr(fd, TCSANOW, &options);
}